import { createRouter, createWebHashHistory } from 'vue-router';

export default createRouter({
  history: createWebHashHistory(),
  routes: [
    {
      path: '/',
      redirect: '/home',
    },
    {
      path: '/login',
      name: 'login',
      meta: { name: '登录' },
      component: () => import('@/views/login/index.vue'),
    },
    {
      name: 'home',
      path: '/home',
      component: () => import('@/layouts/index.vue'),
      redirect: { name: 'results' },
      children: [
        {
          path: 'results',
          name: 'results',
          component: () => import('@/views/results/index.vue'),
          meta: { name: '成绩分析', id: 8 },
        },
        {
          path: 'useradmin',
          name: 'useradmin',
          meta: { name: '用户管理', permissions: '超级管理员', id: 2, isCache: true },
          component: () => import('@/views/useradmin/index.vue'),
        },
        {
          path: 'studentadmin',
          name: 'studentadmin',
          meta: { name: '学生管理', permissions: '学生管理员', id: 3, isCache: true },
          component: () => import('@/views/studentadmin/index.vue'),
        },
        {
          path: 'professionaladmin',
          name: 'professionaladmin',
          meta: { name: '专业管理', permissions: '学生管理员', id: 9, isCache: true },
          component: () => import('@/views/professional/index.vue'),
        },
        {
          path: 'classadmin',
          name: 'classadmin',
          meta: { name: '班级管理', permissions: '学生管理员', id: 10 },
          component: () => import('@/views/class/index.vue'),
        },
        {
          path: 'subject',
          name: 'subject',
          meta: { name: '科目管理', permissions: '学生管理员', id: 11, isCache: true },
          component: () => import('@/views/subject/index.vue'),
        },
        {
          path: 'examination',
          name: 'examination',
          meta: { name: '考试管理', permissions: '考试管理员', id: 4 },
          component: () => import('@/views/examination/index.vue'),
        },
        {
          path: 'radio',
          name: 'radio',
          meta: { name: '单选题', permissions: '考试管理员', id: 5 },
          component: () => import('@/views/radio/index.vue'),
        },
        {
          path: 'select',
          name: 'select',
          meta: { name: '多选题', permissions: '考试管理员', id: 6 },
          component: () => import('@/views/select/index.vue'),
        },
        {
          path: 'judge',
          name: 'judge',
          meta: { name: '判断题', permissions: '考试管理员', id: 7 },
          component: () => import('@/views/judge/index.vue'),
        },
        {
          path: 'recyclingRadio',
          name: 'recyclingRadio',
          meta: { name: '单选题回收站', permissions: '考试管理员', id: 12 },
          component: () => import('@/views/recyclingRadio/index.vue'),
        },
        {
          path: 'recyclingSelect',
          name: 'recyclingSelect',
          meta: { name: '多选题回收站', permissions: '考试管理员', id: 13 },
          component: () => import('@/views/recyclingSelect/index.vue'),
        },
        {
          path: 'recyclingJudge',
          name: 'recyclingJudge',
          meta: { name: '判断题回收站', permissions: '考试管理员', id: 14 },
          component: () => import('@/views/recyclingJudge/index.vue'),
        },
        {
          path: '403',
          name: '403',
          meta: { name: '403' },
          component: () => import('@/views/403/index.vue'),
        },
        {
          path: 'refresh',
          name: 'refresh',
          component: () => import('@/views/refresh/index.vue'),
        },
      ],
    },
    {
      path: '/:pathMacth(.*)',
      name: '404',
      component: () => import('@/views/404/index.vue'),
      meta: { name: '404' },
    },
  ],
});
